using Serilog;
using Serilog.Events;
using WebApplication1;

// Log.Logger = new LoggerConfiguration()
//     .WriteTo.Console()
//     .CreateBootstrapLogger();


Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Error()
    
    .Enrich.FromLogContext()
    .WriteTo.Console()
  .CreateLogger();

Log.Information("Starting up"); 

var builder = WebApplication.CreateBuilder(args); 
builder.Host.UseSerilog((ctx, lc) => lc.ReadFrom.Configuration(builder.Configuration));

Log.Error("11111111111111111");

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();


builder.Services.Configure<TestOptions>(builder.Configuration);

builder.Services.AddTransient(typeof(ITest<>), typeof(Test<>));

var app = builder.Build();



// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();